package com.roc.web.listener;

import java.util.Enumeration;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import org.apache.log4j.Logger;

public class AcessListener implements HttpSessionListener {

	private final static Logger logger = Logger.getLogger(AcessListener.class);

	public void sessionCreated(HttpSessionEvent arg0) {
		HttpSession sc = arg0.getSession();

	}

	public void sessionDestroyed(HttpSessionEvent arg0) {
		HttpSession sc = arg0.getSession();

		@SuppressWarnings("unchecked")
		Enumeration<String> e = sc.getAttributeNames();
		while (e.hasMoreElements()) {
			Object obj = e.nextElement();
			Object sessionObj = sc.getAttribute((String) obj);
			logger.info("*********** destroyed session objects name ["
					+ (String) obj + "]:[" + sessionObj + "]*******");
		}

	}

}
